﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ELab.Message
{
    public class Checksum
    {
        public static byte GetData(byte[] array)
        {
            return array.Aggregate<byte, byte>(0, (current, b) => (byte)((current + b) & 0xff));
        }

        public static byte GetData(object[] array)
        {
            return (byte)array.Aggregate<object, object>(0, (current, b) => (byte)(((byte)current + (byte)b) & 0xff));
        }
    }
}
